﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<CRM.Database.Model.TrainingsSchedules>>" %>
<%@ Import Namespace="CRM.Resourses" %>



<% Html.DevExpress().GridView(settings =>
                                    {
                                        settings.Name = "gdTrainingsSchedule";
                                        settings.KeyFieldName = "IdTrainingsSchedule";
                                        settings.CallbackRouteValues = new { Controller = "TC", Action = "TrainingsSchedulesPartial" };
                                        settings.SettingsPager.PageSize = 20;
                                        settings.Settings.ShowFilterBar = GridViewStatusBarMode.Visible;
                                        settings.Settings.ShowFilterRow = true;
                                        settings.Settings.ShowGroupPanel = true;

                                        //Тип 1)
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingCoursesType;
                                            column.FieldName = "CourseTypeLocalazed";
                                        });
                                        
                                        //Рубрика 2)
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsRubric;
                                            column.FieldName = "RubricName";
                                        });
                                        
                                        //Регион 3)
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.profineRegion;
                                            column.FieldName = "profineRegionName";
                                        });
                                        
                                        //Город 4)
                                        
                                        //Название курса 5)
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsCourseName;
                                            column.FieldName = "CourseName";
                                        });

                                        //Дата 5.5)
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsDate;
                                            //column.ColumnType = MVCxGridViewColumnType.DateEdit;
                                            column.FieldName = "PlannedDateExt";
                                        });

                                        //Кол-во дней 6)
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsDuration;
                                            column.FieldName = "Duration";
                                        });

                                        //Заявленное кол-во чу 7)
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsCountRequested;
                                            column.FieldName = "ParticipantsCountRequested";
                                        });

                                        //Фактическое кол-во уч 8)
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsCountAvailable;
                                            column.FieldName = "ParticipantsCountAvailable";
                                        });
                                        
                                        //Название клиента 9)

                                        //тип курса 10)
                                        settings.Columns.Add(column =>
                                        {
                                            column.Caption = Resourses.TrainingsCourseCost;
                                            column.FieldName = "CourseCost";
                                            column.Width = 40;
                                        });

                                        ////Добавление локализованного комбобокса
                                        //settings.Columns.Add(column =>
                                        //{
                                        //    column.FieldName = "IdTrainingsPlace";
                                        //    column.Caption = Resourses.TrainingsPlace;
                                        //    column.ColumnType = MVCxGridViewColumnType.ComboBox;
                                        //    var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
                                        //    if (comboBoxProperties != null)
                                        //    {
                                        //        var placesCol = new CRM.Database.Model.TrainingsPlacesCollection();
                                        //        comboBoxProperties.DataSource = placesCol.TrainingsPlacesList;
                                        //        comboBoxProperties.TextField = "LocalizedName";
                                        //        comboBoxProperties.ValueField = "IdTrainingsPlace";
                                        //        comboBoxProperties.ValueType = typeof(int);
                                        //    }
                                        //});
                                        ////конец комбобокса

                                        //settings.Columns.Add(column =>
                                        //{
                                        //    column.Caption = Resourses.TrainingsPlace; ;
                                        //    column.FieldName = "LocationName";
                                        //});

                                        ////Добавление комбобоксов
                                        //settings.Columns.Add(column =>
                                        //{
                                        //    column.FieldName = "IdTrainingsTrainer";
                                        //    column.Caption = Resourses.TrainingsTrainer;
                                        //    column.ColumnType = MVCxGridViewColumnType.ComboBox;
                                        //    var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
                                        //    if (comboBoxProperties != null)
                                        //    {
                                        //        var trainersCol = new CRM.Database.Model.TrainingsTrainersCollection();
                                        //        comboBoxProperties.DataSource = trainersCol.TrainingsTrainersList;
                                        //        comboBoxProperties.TextField = "Name";
                                        //        comboBoxProperties.ValueField = "IdTrainingsTrainer";
                                        //        comboBoxProperties.ValueType = typeof(int);
                                        //    }
                                        //});
                                        ////конец комбобокса

                                        //settings.Columns.Add(column =>
                                        //{
                                        //    column.Caption = Resourses.TrainingsTrainer;
                                        //    column.FieldName = "TrainerName";
                                        //});
                                        
                                        //settings.Columns.Add(column =>
                                        //{
                                        //    column.Caption = Resourses.TrainingsParticipantCost;
                                        //    column.FieldName = "ParticipantCoctExt";
                                        //});

                                        //settings.Columns.Add(column =>
                                        //{
                                        //    column.Caption = Resourses.TrainingsCountApproved;
                                        //    column.FieldName = "ParticipantsCountApproved";
                                        //});

                                        //settings.Columns.Add(column =>
                                        //{
                                        //    column.Caption = Resourses.TrainingsCountActual;
                                        //    column.FieldName = "ParticipantsCountActual";
                                        //});

                                        ////Добавление локализованного комбобокса
                                        //settings.Columns.Add(column =>
                                        //{
                                        //    column.FieldName = "IdTrainingCoursesStatus";
                                        //    column.Caption = Resourses.TrainingCoursesStatus;
                                        //    column.ColumnType = MVCxGridViewColumnType.ComboBox;
                                        //    var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
                                        //    if (comboBoxProperties != null)
                                        //    {
                                        //        var statusesCol = new CRM.Database.Model.TrainingCoursesStatusesCollection();
                                        //        comboBoxProperties.DataSource = statusesCol.TrainingCoursesStatusesList;
                                        //        comboBoxProperties.TextField = "LocalizedName";
                                        //        comboBoxProperties.ValueField = "IdTrainingCoursesStatus";
                                        //        comboBoxProperties.ValueType = typeof(int);
                                        //    }
                                        //});
                                        ////конец комбобокса

                                        //settings.Columns.Add(column =>
                                        //{
                                        //    column.Caption = Resourses.TrainingCoursesStatus;
                                        //    column.FieldName = "CourseStatus";
                                        //});
                                        
                                     }).Bind(Model.ToList()).GetHtml();%>